import Vue from 'vue'
import App from './App.vue'
import router from './router/index.js'
import store from './store/index.js'
import './element.js'
import '@/style/common.scss'
import '@/style/iconfont.scss'
import './checkAppVersion.js'
import { datafluxRum } from '@cloudcare/browser-rum';

window.datafluxRum = datafluxRum;
//观测云监控，非开发环境就检测
if (process.env.NODE_ENV !== 'development') {
    datafluxRum.init({
        applicationId: 'i18n_management_platform_20230421',
        datakitOrigin: 'https://apm-datakit.yintaerp.com', // 协议（包括：//），域名（或IP地址）[和端口号]
        env: window.PROJECT_PROCESS_ENV || 'dev',
        version: window.APP_VERSION || '1.0.0',
        service: 'i18n-management-platform',
        trackInteractions: true,
        traceType: 'ddtrace' // 非必填，默认为ddtrace，目前支持 ddtrace、zipkin、skywalking_v3、jaeger、zipkin_single_header、w3c_traceparent 6种类型
    });

    router.beforeEach((to, from, next) => {
        // 观测云记录页面路径访问的行为
        datafluxRum.addAction('visit', {
            fromPath: from.fullPath,
            toPath: to.fullPath
        });
        next()
    });
}


window.Vue = Vue;

//注册全局筛选器
import Filters from '@/filters'

Object.keys(Filters).forEach(filtName => {
    Vue.filter(filtName, Filters[filtName])
});
Vue.prototype.$filters = Vue.options.filters
Vue.config.productionTip = false;

window.globalVueApp = new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#languager-app')

